#lang racket

(define (id x) x)

(define (inc x) (+ x 1))

(define (pi-num x) (* (floor(/ (+ x 2) 2)) 2))

(define (pi-denom x) (+ (* (floor (/ (+ x 1) 2)) 2) 1))

(define (pi-term x) (/ (pi-num x) (pi-denom x)))

(define (product term a next b)
  (if (> a b)
      1
      (* (term a)
         (product term (next a) next b))))

(define (factorial n) (product id 1 inc n))

(factorial 6)

(define (pi-quarter p) (product pi-term 1 inc p))

(* (pi-quarter 1000) 4.0)